<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" href="${staticServer}/inc/style/main.css"/>
	<link rel="stylesheet" href="${staticServer}/inc/style/page.css"/>
	<link rel="stylesheet" href="${staticServer}/css/work_today.css"/>
	<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css"/>
	<link rel="stylesheet" href="${staticServer}/css/consultant_client_tracking.css"/>
	<script src="${staticServer}/inc/js/jquery.js"></script>
	<script src="${staticServer}/inc/js/pageset.js"></script>
	<script src="${staticServer}/inc/js/model_resp.js"></script>
	<script src="${staticServer}/inc/js/datepicker.js"></script>
	<script src="${staticServer}/inc/js/submitter.js"></script>
	<script src="${staticServer}/inc/js/tips.js?1.4"></script>
	<script src="${staticServer}/js/web/consultant_client_tracking_list.js"></script>
	<script>
	//var infopad = parent.infopad;

	function init()
	{
		select_date( 'start_date' );
		select_date( 'end_date' );
	}

	function select_date( targetid )
	{
		$( '#' + targetid ).Zebra_DatePicker( { format: 'Y-m-d', show_icon: false } );
	}

	function starquery( type )
	{
		if( type == 0 )
		{
			var user = $( "#user" ).val();
			var sdate = $( "#start_date" ).val();
			var edate = $( "#end_date" ).val();
			var param = [];
			if( !empty( user ) ) param.push( "nickname=" + user );
			if( !empty( sdate ) ) param.push( "startTime=" + sdate );
			if( !empty( edate ) ) param.push( "endTime=" + edate );

			location.href = "${contextPath}/index/system_reserve_expired.htm?" + param.join( "&" );
		}
		else
		{
			location.href = "${contextPath}/index/system_reserve_expired.htm";
		}
	}
	
	var getFollow = function(keyname,id){
	$("#traId").val(id);
	$.post("${contextPath}/index/get_client_follow.json", {
		"keyname":keyname
	}, function(ms) {
		var list = ms.list;
		var objHtml = "";
		$("#trackList"+id).val("");
		if(list!=null){
			var j=0;
			for(var i=0;i<list.length;i++){
				var state = "";
				if(list[i].state=="" || list[i].state==null){
					state = '<a class="stateitem caption">无变化</a>';
				}else{
					state = '<a class="stateitem">'+list[i].state+'</a>';
				}
				objHtml += '<ul>'+
	            			'<li>'+
	            				'<p class="trackingtitle" style="display: block;">第 '+(++j)+' 次跟踪记录<em class="caption">（负责人：'+list[i].nickname+'　日期：'+list[i].createTime+'）</em><a class="btnHidden"></a></p>'+
	            				'<p class="trackingstate" style="display: block;"><b>客户状态</b><span>'+state+'</span></p>'+
	            				'<p style="display: block;"><b>备注情况</b></p>'+
	            				'<div class="content" style="display: block;">'+list[i].remark+'</div>'+
	            			'</li>'+
	            		'</ul>'
			}
			$("#trackList"+id).html('<a class="stress unit" onclick="remove_tracking()"> 点击隐藏跟踪记录 </a>'+objHtml);
			$("#__TRACKING_LIST"+id).show();
		}
		
	});
}
	
	var remove_tracking = function(){
		var id = $("#traId").val();
		$("#__TRACKING_LIST"+id).hide();
	}
	
//输入框回车事件
function EnterPress(e){
var e = e || window.event; 
if(e.keyCode == 13){ 
	var total = $(".total").val();
	var page = $("#pages").val();
	if(page<=total){
		location.href=encodeURI("${contextPath}/index/system_reserve_expired.htm?currPage="+page);
	}else{
		alert("输入的页数要小于总页数。");
	}
	} 
} 

	</script>
</head>

<body>
<input type="hidden" id="traId" value="">
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>咨询师业务管理</li>
			<li>&gt;</li>
			<li class="current">过期预约查询</li>
		</ul>
	</div>
	<div id="container">
		<div id="title"></div>
		<table class="form_table">
			<tr>
				<td><label><b>查询条件：</b></label>
					<label for="user">按来源渠道筛选：</label>
					<input type="text" id="user" size="15" value="${nickname}" placeholder="来源渠道的筛选"/>
					<label for="start_date">起始日期：</label>
					<input type="text" name="start_date" id="start_date" size="15" value="${startTime}"/>
					<label for="end_date">终止日期：</label>
					<input type="text" name="end_date" id="end_date" size="15" value="${endTime}"/>
					<input type="button" value=" 查 询 " onclick="starquery(0)"/>
					<input type="button" value=" 重 置 " onclick="starquery(1)"/>
				</td>
			</tr>
		</table>
		<table>
			<tr class="fields">
				<th>预约日期</th>
				<th>客户姓名</th>
				<th>所在地</th>
				<th>渠道</th>
				<th>预约类型</th>
				<th>联系方式</th>
				<th>最新跟踪情况</th>
				<th>跟踪次数</th>
				<th>操作</th>
			</tr>
			<#if list??>
				<#list list as list>
				<tr class="even_row">
					<td align="center"><span class="quote">${list.date}</span><br>${list.time}</td>
					<td align="center" class="stress" width="120">${list.nickname}<em class="valid">（有效）</em></td>
					<td align="center">${list.province}-${list.city}</td>
					<td align="center">${list.sourcens}</td>
					<td align="center"><#if list.non=="0">测评<#else>非测评</#if>							
						<p class="caption">${list.notice}</p>
					</td>
					<td align="center">
				<#if list.phlist??>
							<#list list.phlist as phlist>
							<a title="<#if phlist.phone!="">电话：${phlist.phone}</#if> <#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> " id="${list.id}">
							<#assign phone = "${phlist.phone}">
							<#if phlist.name=="爸爸" || phlist.name=="妈妈">
								<em class="caption">电话：</em>${phlist.phone}
								<em class="caption">关系：</em>${phlist.name}</br>
							<#elseif phlist.guanxi!="">
								<em class="caption">电话：</em>${phlist.phone}
								<em class="caption">关系：</em>${phlist.guanxi}</br>
							<#else>
								<em class="caption">电话：</em>${phlist.phone}
								<em class="caption">关系：</em>${phlist.name}</br>
							</#if>
							</a>
     						</#list>
     						<#else>
						<a title="<#if list.phone!="" && list.phone?contains('[]')==false>电话：${list.phone}</#if> <#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> " id="${list.id}">
     						<#if list.phone!="" && list.phone?contains('[]')==false>
     						<em class="caption">电话：</em>${list.phone}
     						<#elseif list.qq!="">
     						<em class="caption">QQ:</em>${list.qq}
     						<#elseif list.email!="">
     						<em class="caption">email:</em>${list.email}
     						</#if>
     						</a>
     					  </#if>
					</td>
					<td width="150" title="${list.last_track}" id=""><#if (list.last_track?length > 20)>${list.last_track?substring(0,15)}...<#else>${list.last_track}</#if><br><span class="caption">${list.endtime}</span></td>
					<td align="center">${list.trackings}次</td>
					<td align="center">
						<#if webutil.getCookieUser().usergroup=="3">
							<a href="${contextPath}/index/system_reserve_view.htm?keyname=${list.keyname}">跟踪</a>-
						</#if>
						<a href="${contextPath}/index/system_reserve_view.htm?keyname=${list.keyname}">预约详情</a> - 
						<a class="btnSearchTracking" onclick="getFollow('${list.client}','${list.id}')">历史跟踪</a>
					</td>
				</tr>
             	<tr id="__TRACKING_LIST${list.id}" style="display:none">
	            		<td colspan="10" class="trackinglst" id="trackList${list.id}">
	            		</td>
	            </tr>
				</#list>
			</#if>
		</table>
	</div>
	<div id="pager" style="width: 849px;">
	<ul id="pagination">
		<#if page??>
		<#if page.pagetotal?? && page.pagetotal!="0">
	<#assign pagetotal = page.pagetotal>
	<#else>
	<#assign pagetotal = 1>
	</#if>
			<#if page.currpage??>
	<#assign currpage = page.currpage>
	<#else>
	<#assign currpage = 1>
	</#if>
				<#if currpage==1 >
				    <li class="previous-off">首页</li>
					<li class="previous-off">上一页</li>
					<#else>
					<li class="previous"><a href="${contextPath}/index/system_reserve_expired.htm?currPage=1">首页</a></li>
					<li class="previous"><a href="${contextPath}/index/system_reserve_expired.htm?currPage=${currpage-1}">上一页</a></li>
					</#if>
					
		<#if pagetotal<=11>
			<#list 1..pagetotal as index_up>  
	           <#if currpage==index_up > 
	           		<li class="current">${index_up}</li>
	           <#else>
	           		<li><a href="${contextPath}/index/system_reserve_expired.htm?currPage=${index_up}">${index_up}</a></li>  
	           </#if>  
			</#list>  
		<#else>
			<#if currpage<=8 >
				<#list 1..9 as index_up>  
	           	<#if currpage==index_up >  
	            	<li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_reserve_expired.htm?currPage=${index_up}">${index_up}</a></li> 
	           	</#if>
	           	</#list>  
	           	<li>...</li>
	           	<li><a href="${contextPath}/index/system_reserve_expired.htm?currPage=${pagetotal}">${pagetotal}</a></li>  
				
			<#elseif (currpage>= 9 && currpage<pagetotal-7)  >	
				<li><a href="${contextPath}/index/system_reserve_expired.htm?currPage=1">1</a></li>  
				<li>...</li>
				<#list currpage-3..currpage+3 as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_reserve_expired.htm?currPage=${index_up}">${index_up}</a></li>  
	           	</#if>
	           	</#list>
				<li>...</li>
	           	<li><a href="${contextPath}/index/system_reserve_expired.htm?currPage=${pagetotal}">${pagetotal}</a></li>   
			<#else>
				<li><a href="${contextPath}/index/system_reserve_expired.htm?currPage=1">1</a></li> 
				<li>...</li>
				<#list pagetotal-8..pagetotal as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_reserve_expired.htm?currPage=${index_up}">${index_up}</a></li> 
	           	</#if>
				</#list>  
			</#if>
			
		</#if> 
		
		<#if currpage==pagetotal >
		 	<li class="previous-off">下一页</li>
		 	<li class="previous-off">尾页</li>
		<#else>
			<li class="previous"><a href="${contextPath}/index/system_reserve_expired.htm?currPage=${currpage+1}">下一页</a></li>
			<li class="previous"><a href="${contextPath}/index/system_reserve_expired.htm?currPage=${page.pagetotal}">尾页</a></li>
		</#if>
			<input type="hidden" class="total" value="${page.pagetotal}">
			<li class="previous"><input type="text" id="pages" onkeypress="EnterPress(event)" size="10" placeholder="跳转页数" style="line-height: 30px; padding: 0 11px 0 11px;"></li>
			<li class="pageinfo">共${page.total}条记录</li>
	</#if>
	</ul></div>
	<div class="emptyline"></div>
</body>
</html>